package com.electromagnetic.industry.software.manage.mapper;

import com.electromagnetic.industry.software.common.pojo.UserLoginInfo;
import com.electromagnetic.industry.software.manage.pojo.models.User;
import com.electromagnetic.industry.software.manage.pojo.other.PublishParam;
import com.electromagnetic.industry.software.manage.pojo.other.SearchKeyWords;
import com.electromagnetic.industry.software.manage.pojo.other.SingleUserResponse;
import com.electromagnetic.industry.software.manage.pojo.other.UserDeleteKeyWords;
import com.electromagnetic.industry.software.manage.pojo.req.*;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface UserMappers {
    UserMappers INSTANCE = Mappers.getMapper(UserMappers.class);

    /**
     * 用户Request转用户模型
     *
     * @param userRequest
     * @return
     */
    User getUserRequestToModel(UserRequest userRequest);

    /**
     * 用户登录Request转用户登录模型
     *
     * @param loginRequest
     * @return
     */
    UserLoginInfo getUserLoginRequestToModel(UserLoginRequest loginRequest);

    /**
     * 获取单条用户信息Request转用户模型
     *
     * @param user
     * @return
     */
    SingleUserResponse getSingleUserToResponse(User user);


    /**
     * 用户发布request转用户发布参数模型
     *
     * @param userPublishRequest
     * @return
     */
    PublishParam getUserPublishRequestToModel(UserPublishRequest userPublishRequest);

    /**
     * 获取单条用户信息Request转用户模型
     *
     * @param searchUserRequest
     * @return
     */
    SearchKeyWords getSearchKeywordsRequestToModel(SearchUserRequest searchUserRequest);

    /**
     * 获取用户列表转response列表
     *
     * @param users
     * @return
     */
    List<SingleUserResponse> userListToResponseList(List<User> users);

    /**
     * 编辑用户Request转用户模型
     *
     * @param userModiRequest
     * @return
     */
    User getUserModiRequestToModel(UserModiRequest userModiRequest);

    /**
     * 校验工号唯一性Request转用户模型
     *
     * @param userWorkNumRequest
     * @return
     */
    User getUserWorkNumRequestToModel(UserWorkNumRequest userWorkNumRequest);

    /**
     * 删除单条用户信息Request转用户模型
     *
     * @param userDeleteRequest
     * @return
     */
    UserDeleteKeyWords getUserDeleteRequestToModel(UserDeleteRequest userDeleteRequest);
}
